using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "SOHONNHAN", Schema="dbo")]
	[Table(Name = "[dbo].[SOHONNHAN]")]
	public partial class SOHONNHAN : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _mahonnhan;

		private System.Guid? _magiaodan_chong;

		private System.Guid? _magiaodan_vo;

		private System.String _tenchong;

		private System.String _tenvo;

		private System.Guid? _manhanchung1;

		private System.String _tennhanchung1;

		private System.Guid? _manhanchung2;

		private System.String _tennhanchung2;

		private System.Guid? _malinhmuc;

		private System.String _tenlinhmuc;

		private System.Guid? _mahientranghonnhan;

		private System.Guid? _matongiao;

		private System.String _tencha;

		private System.String _tenme;

		private System.Guid? _magiaophan;

		private System.Guid? _magiaohat;

		private System.Guid? _magiaoxu;

		private System.String _tengiaoxu;

		private System.String _diachi;

		private System.Boolean? _lyhon;

		private System.String _ghichu;

		private System.Int32? _ngay;

		private System.Int32? _thang;

		private System.Int32? _nam;

		private System.Int32? _maso;

		private System.Boolean? _luuso;

		private HIENTRANGHONNHAN _prt_hientranghonnhan;

		private LINHMUC _prt_linhmuc;

		private GIAOXU _prt_giaoxu;

		private GIAOPHAN _prt_giaophan;

		private GIAODAN _prt_giaodan;

		private GIAOHAT _prt_giaohat;

		private TONGIAO _prt_tongiao;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MAHONNHAN", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MAHONNHAN
		{
			get
			{
				return _mahonnhan;
			}
			set
			{
				OnChanged(this, "MAHONNHAN");
				_mahonnhan = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAODAN_CHONG", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAODAN_CHONG
		{
			get
			{
				return _magiaodan_chong;
			}
			set
			{
				OnChanged(this, "MAGIAODAN_CHONG");
				_magiaodan_chong = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAODAN_VO", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAODAN_VO
		{
			get
			{
				return _magiaodan_vo;
			}
			set
			{
				OnChanged(this, "MAGIAODAN_VO");
				_magiaodan_vo = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENCHONG", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENCHONG
		{
			get
			{
				return _tenchong;
			}
			set
			{
				OnChanged(this, "TENCHONG");
				_tenchong = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENVO", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENVO
		{
			get
			{
				return _tenvo;
			}
			set
			{
				OnChanged(this, "TENVO");
				_tenvo = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MANHANCHUNG1", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MANHANCHUNG1
		{
			get
			{
				return _manhanchung1;
			}
			set
			{
				OnChanged(this, "MANHANCHUNG1");
				_manhanchung1 = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENNHANCHUNG1", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENNHANCHUNG1
		{
			get
			{
				return _tennhanchung1;
			}
			set
			{
				OnChanged(this, "TENNHANCHUNG1");
				_tennhanchung1 = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MANHANCHUNG2", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MANHANCHUNG2
		{
			get
			{
				return _manhanchung2;
			}
			set
			{
				OnChanged(this, "MANHANCHUNG2");
				_manhanchung2 = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENNHANCHUNG2", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENNHANCHUNG2
		{
			get
			{
				return _tennhanchung2;
			}
			set
			{
				OnChanged(this, "TENNHANCHUNG2");
				_tennhanchung2 = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MALINHMUC", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MALINHMUC
		{
			get
			{
				return _malinhmuc;
			}
			set
			{
				OnChanged(this, "MALINHMUC");
				_malinhmuc = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENLINHMUC", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENLINHMUC
		{
			get
			{
				return _tenlinhmuc;
			}
			set
			{
				OnChanged(this, "TENLINHMUC");
				_tenlinhmuc = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAHIENTRANGHONNHAN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAHIENTRANGHONNHAN
		{
			get
			{
				return _mahientranghonnhan;
			}
			set
			{
				OnChanged(this, "MAHIENTRANGHONNHAN");
				_mahientranghonnhan = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MATONGIAO", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MATONGIAO
		{
			get
			{
				return _matongiao;
			}
			set
			{
				OnChanged(this, "MATONGIAO");
				_matongiao = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENCHA", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENCHA
		{
			get
			{
				return _tencha;
			}
			set
			{
				OnChanged(this, "TENCHA");
				_tencha = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENME", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENME
		{
			get
			{
				return _tenme;
			}
			set
			{
				OnChanged(this, "TENME");
				_tenme = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOPHAN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOPHAN
		{
			get
			{
				return _magiaophan;
			}
			set
			{
				OnChanged(this, "MAGIAOPHAN");
				_magiaophan = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOHAT", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOHAT
		{
			get
			{
				return _magiaohat;
			}
			set
			{
				OnChanged(this, "MAGIAOHAT");
				_magiaohat = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOXU", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOXU
		{
			get
			{
				return _magiaoxu;
			}
			set
			{
				OnChanged(this, "MAGIAOXU");
				_magiaoxu = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENGIAOXU", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENGIAOXU
		{
			get
			{
				return _tengiaoxu;
			}
			set
			{
				OnChanged(this, "TENGIAOXU");
				_tengiaoxu = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 500, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIACHI", DbType = "nvarchar(500)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIACHI
		{
			get
			{
				return _diachi;
			}
			set
			{
				OnChanged(this, "DIACHI");
				_diachi = value;
			}
		}

		[ExtraColumn(DbType = "bit", Length = 0, TypeName = "System.Boolean", Type = typeof(System.Boolean), CanBeNull = true)]
		[Column(Name = "LYHON", DbType = "bit", IsPrimaryKey = false, CanBeNull = true)]
		public System.Boolean? LYHON
		{
			get
			{
				return _lyhon;
			}
			set
			{
				OnChanged(this, "LYHON");
				_lyhon = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 2000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "GHICHU", DbType = "nvarchar(2000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String GHICHU
		{
			get
			{
				return _ghichu;
			}
			set
			{
				OnChanged(this, "GHICHU");
				_ghichu = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NGAY", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NGAY
		{
			get
			{
				return _ngay;
			}
			set
			{
				OnChanged(this, "NGAY");
				_ngay = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "THANG", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? THANG
		{
			get
			{
				return _thang;
			}
			set
			{
				OnChanged(this, "THANG");
				_thang = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NAM", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NAM
		{
			get
			{
				return _nam;
			}
			set
			{
				OnChanged(this, "NAM");
				_nam = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "MASO", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? MASO
		{
			get
			{
				return _maso;
			}
			set
			{
				OnChanged(this, "MASO");
				_maso = value;
			}
		}

		[ExtraColumn(DbType = "bit", Length = 0, TypeName = "System.Boolean", Type = typeof(System.Boolean), CanBeNull = true)]
		[Column(Name = "LUUSO", DbType = "bit", IsPrimaryKey = false, CanBeNull = true)]
		public System.Boolean? LUUSO
		{
			get
			{
				return _luuso;
			}
			set
			{
				OnChanged(this, "LUUSO");
				_luuso = value;
			}
		}

		public HIENTRANGHONNHAN PRT_HIENTRANGHONNHAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_hientranghonnhan == default(HIENTRANGHONNHAN)))
					InfoTech.Core.Data.Receiver.TypeObject<HIENTRANGHONNHAN>.Select(this, "PRT_HIENTRANGHONNHAN", new[] { new Vector<string, string>("MAHIENTRANGHONNHAN", "MAHIENTRANGHONNHAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_hientranghonnhan;
			}
			set
			{
				_prt_hientranghonnhan = value;
			}
		}

		public LINHMUC PRT_LINHMUC
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_linhmuc == default(LINHMUC)))
					InfoTech.Core.Data.Receiver.TypeObject<LINHMUC>.Select(this, "PRT_LINHMUC", new[] { new Vector<string, string>("MALINHMUC", "MACHAXU"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_linhmuc;
			}
			set
			{
				_prt_linhmuc = value;
			}
		}

		public GIAOXU PRT_GIAOXU
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaoxu == default(GIAOXU)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOXU>.Select(this, "PRT_GIAOXU", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaoxu;
			}
			set
			{
				_prt_giaoxu = value;
			}
		}

		public GIAOPHAN PRT_GIAOPHAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaophan == default(GIAOPHAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOPHAN>.Select(this, "PRT_GIAOPHAN", new[] { new Vector<string, string>("MAGIAOPHAN", "MAGIAOPHAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaophan;
			}
			set
			{
				_prt_giaophan = value;
			}
		}

		public GIAODAN PRT_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaodan == default(GIAODAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "PRT_GIAODAN", new[] { new Vector<string, string>("MAGIAODAN_CHONG", "MAGIAODAN"), new Vector<string, string>("MAGIAODAN_VO", "MAGIAODAN"), new Vector<string, string>("MANHANCHUNG1", "MAGIAODAN"), new Vector<string, string>("MANHANCHUNG2", "MAGIAODAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaodan;
			}
			set
			{
				_prt_giaodan = value;
			}
		}

		public GIAOHAT PRT_GIAOHAT
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaohat == default(GIAOHAT)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOHAT>.Select(this, "PRT_GIAOHAT", new[] { new Vector<string, string>("MAGIAOHAT", "MAGIAOHAT"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaohat;
			}
			set
			{
				_prt_giaohat = value;
			}
		}

		public TONGIAO PRT_TONGIAO
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_tongiao == default(TONGIAO)))
					InfoTech.Core.Data.Receiver.TypeObject<TONGIAO>.Select(this, "PRT_TONGIAO", new[] { new Vector<string, string>("MATONGIAO", "MATONGIAO"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_tongiao;
			}
			set
			{
				_prt_tongiao = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(SOHONNHAN);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
